#include<iostream>
#include"contacts.pb.h"
uning namespace std;

int main()
{
    string str;
    contact::PeoleInfo people;
    people.set_name("张三");
    people.set_age(20);
    if(people.SerializeToString(&str))
    {
        cout<<"序列化失败"<<endl;
        return -1;
    }
    cout<<"序列化结果"<<str<<endl;
    contact::PeoleInfo ret;
    //进行反序列化
    if(ret.ParseFromString(str))
    {
        cout<<"反序列化失败"<<endl;
    }
    cout<<"姓名："<<ret.name()<<endl;
    cout<<"年龄："<<ret.age()<<endl;
    
    return 0;
}